package com.liull.netty.firstexample;

import com.liull.netty.chat.ChatServerHandler;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;

/**
 * @Author: liull
 * @Description:
 * @Date: Created in 20:02 2020/9/23
 * @Modified By:
 */
public class TestChannelInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        // http服务端编解码器
        pipeline.addLast("httpServerCodec", new HttpServerCodec());
        // 自定义处理器返回hello baby
        pipeline.addLast("testHttpServerHandler", new TestHttpServerHandler());
    }
}
